package com.cupk.carManageMaster.common.domain;


import java.util.HashMap;
import java.util.Map;

public class Msg {
    int code;   //错误码
    String Message; //消息提示
    Map<String, Object> data = new HashMap<String, Object>();   //数据

    //无权访问
    public static Msg denyAccess(String message) {
        Msg result = new Msg();
        result.setCode(300);
        result.setMessage(message);
        return result;
    }

    //操作成功
    public static Msg success(String message) {
        Msg result = new Msg();
        result.setCode(200);
        result.setMessage(message);
        return result;
    }

    //客户端操作失败
    public static Msg fail(String message) {
        Msg result = new Msg();
        result.setCode(400);
        result.setMessage(message);
        return result;
    }

    public Msg add(String key, Object value) {
        this.data.put(key, value);
        return this;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return Message;
    }

    public void setMessage(String message) {
        Message = message;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public void setData(Map<String, Object> data) {
        this.data = data;
    }
}